package com.czl.module_storehouse.adapter;

import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.czl.base.data.bean.tengyun.ProductBean;
import com.czl.module_storehouse.R;

/**
 * @author by xubin,
 * @date on 2022/2/17.
 * PS: Not easy to write code, please indicate.
 */
public class SelectedProductAdapter extends BaseQuickAdapter<ProductBean, BaseViewHolder> {

    private int applyNum;

    public SelectedProductAdapter(int layoutResId) {
        super(layoutResId);
    }

    public int getApplyNum() {
        return applyNum;
    }

    public void setApplyNum(int applyNum) {
        this.applyNum = applyNum;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, ProductBean item) {
        baseViewHolder.setText(R.id.tv_title, item.getProductName())
                .setText(R.id.tv_code, "编号：" + item.getProductCode())
                .setText(R.id.tv_loc, item.getStorehouseLocatName());
        baseViewHolder.getView(R.id.iv_delete)
                .setOnClickListener((View.OnClickListener) v -> removeAt(baseViewHolder.getLayoutPosition()));
    }
}
